import logging
import unittest

import jsonschema
from parameterized import parameterized
from api.ihrm_login_api import IhrmLoginApi
from uilts.common_asserts import comm_asserts
from uilts.logging_code import init_log_config
from uilts.read_data import read_login_data


class TestLogin(unittest.TestCase):

    def test_login(self):
        req_body = {
            "mobile": "13800000002",
            "password": "123456"
        }
        resp = IhrmLoginApi.login_api(req_body)
        self.assertEqual(200, resp.status_code)
        scheme = {
            "type": "object",
            "properties": {
                "success": {"const": True},
                "code": {"const": 10000},
                "message": {"type": "string"}
            },
            "required": ["success", "code", "message"]
        }
        jsonschema.validate(resp.json(), scheme)